package main

import (
	"github.com/260444/ginEssential/controller"
	"github.com/260444/ginEssential/middleware"
	"github.com/gin-gonic/gin"
)

func CollectRouter(router *gin.Engine) *gin.Engine {
	router.Use(middleware.CORS())
	router.POST("/api/auth/register", controller.Register)
	router.POST("/api/auth/login", controller.Login)
	router.GET("/api/auth/info", middleware.AuthMiddleware(), controller.Info)
	airport := router.Group("/api/MISUI")
	airportController := controller.NewAirportController()
	{
		airport.GET("getairport", middleware.AuthMiddleware(), airportController.GetAirport)
		airport.POST("addairport", middleware.AuthMiddleware(), airportController.AddAirport)
		airport.PUT("putairport", middleware.AuthMiddleware(), airportController.PutAirport)
		airport.DELETE("delairport", middleware.AuthMiddleware(), airportController.DelAirport)
	}
	return router
}
